#pragma once
#include "Animal.h"
#include "GameUnit.h"
#include "cocos2d.h"
#include "MainScene.h"
#include "ResultSence.h"
#include <cmath>
#include <vector>

using namespace std;
using namespace cocos2d;
class AnimalLayer:public CCLayer
{
private:

	
	vector< vector< Animal* >* > _sortArrays;
	int* _arrays;
	int _width;
	int _height;
	Animal* last_animal;
	Animal* current_animal;
	GameUnit* unit;
	void RemoveAnimal();
	bool rSuccess;
	int points[8];
	cocos2d::CCParticleSystem* m_emitter;
	
public:

	vector< Animal* > _animals;
	void random();
	bool init();
	void discussLine();
	void discussLine(Animal* a1,Animal* a2);
	virtual void setParticle(CCParticleSystemQuad* p);
	void reset(int width,int height);
	virtual void onEnter();
	virtual void onExit();
	bool block();
	void effect(Animal* a1,Animal* a2);
	void particleShow();
	void particleSetPosition(float,float);
	void particleLineTo(float,float);
	void particleDispare();
	bool canEase(int*,Animal& ,Animal& );
	bool isClear();
	void resultSence();
	vector< Animal* > resetAnimalLayerValue();
	bool containsTouchLocation(CCTouch* touch);
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
	virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
	virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);

	virtual void touchDelegateRetain();
	virtual void touchDelegateRelease();
	    // implement the "static node()" method manually
	static AnimalLayer* node(int*,int,int);

	void discussPoint();
};

